import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './assets/css/reset.css'
import Vconsole from 'vconsole'
const vConsole = new Vconsole();

Vue.use(vConsole); // 打包上线时请注释掉

Vue.config.productionTip = false;

import {
    Button,
    Field,
    CellGroup,
    Sticky,
    Search,
    List,
    Card,
    NavBar,
    Stepper,
    Toast,
    Form,
    Popover,
    Uploader,
    SwipeCell,
    Dialog,
    Popup,
    DatetimePicker,
    Image as VanImage,
    Radio,
    RadioGroup,
    Picker
} from 'vant';

Vue.use(Button);
Vue.use(Field);
Vue.use(CellGroup);
Vue.use(Sticky);
Vue.use(Search);
Vue.use(List);
Vue.use(Card);
Vue.use(NavBar);
Vue.use(Stepper);
Vue.use(Toast);
Vue.use(Form);
Vue.use(Popover);
Vue.use(Uploader);
Vue.use(SwipeCell);
Vue.use(Dialog);
Vue.use(Popup);
Vue.use(DatetimePicker);
Vue.use(VanImage);
Vue.use(Radio);
Vue.use(RadioGroup);
Vue.use(Picker);

/**
 * 时间格式化
 * @param fmt
 * @returns {*}
 */
Date.prototype.format = function (fmt) {
    
    var o = {
        "M+": this.getMonth() + 1,// 月份
        "d+": this.getDate(),// 日
        "h+": this.getHours(),// 小时
        "m+": this.getMinutes(),// 分
        "s+": this.getSeconds(), // 秒
        "q+": Math.floor((this.getMonth() + 3) / 3), // 季度
        "S": this.getMilliseconds() // 毫秒
    };
    
    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    for (var k in o)
        if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
    return fmt;
};

new Vue({
    store,
    router,
    render: h => h(App)
}).$mount('#app');
